// 可变长函数的编写
package main

import "fmt"

func varAverage(numbers ...float64) float64 {
	sum := 0.0
	for _, number := range numbers {
		sum += number
	}
	return sum / float64(len(numbers))
}

func main() {
	fmt.Println(varAverage(1, 2, 3, 4, 5, 6))
	fmt.Println(varAverage(1, 2, 3, 4, 5, 6, 7, 8))
	fmt.Println(varAverage(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
	fmt.Println(varAverage([]float64{1, 2, 3, 4}...))
	fmt.Println(varAverage([]float64{1, 2, 3, 4, 5, 6}...))
}
